<!--
 * @Author: jiu yin
 * @Date: 2023-03-30 11:56:32
 * @LastEditTime: 2023-05-17 15:38:51
 * @LastEditors: jiu yin zhen jing
 * @FilePath: \init-admin\src\App.vue
 * jiu
-->


<template>
  <div>
    <el-config-provider :locale="el_locale">
      <RouterView />
    </el-config-provider>
  </div>
</template>

<script setup>
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'
import { useCommon } from "@/stores/common"
import i18n from "@/i18n";

import { watchEffect } from "vue"

//el 组件国际化
let common = useCommon()
const language = computed(() => common.deepCommon.i18n_lang)
const el_locale = computed(() => (language.value === 'zh' ? zhCn : en))

// 自定义国际化
watchEffect(() => {
  i18n.global.locale = language.value
})

</script>

<style lang="scss" scoped></style>
